// pages/suggestion/suggestion.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
    title: "白细胞",
    values: "5.51  10^9/L",
    now: 300,
    lowStandard: 125,
    highStandard: 350,
    overflow:false,
    conArr:[
      { con: "引起胃胀的病因较为复杂，其中急性胃炎、胃 神经官能症、十二指肠溃疡、胃癌。", img: "../images/header_01.png", name:"张三丰",time:"刚刚",imgArr:[
        { img: "https://lg-o8nytxik-1257013711.cos.ap-shanghai.myqcloud.com/active_01.png", name:"药品名字"}
      ]}
    ],
    imgArr:[]
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this
    var bgc = wx.getStorageSync('color')
    wx.setNavigationBarColor({
      frontColor: "#ffffff",
      backgroundColor: bgc,
    })
    var highStandard = that.data.highStandard
    var lowStandard = that.data.lowStandard
    var max = highStandard + (highStandard - lowStandard)
    var min = lowStandard - (highStandard - lowStandard)
    var count = max - min
    var now = that.data.now
    var nows = now - min
    var left = nows / count * 100
    // console.log(arr)
    // console.log(left)
    that.setData({
      left: left
    })
  },
  //底部加号切换
  overClick:function(){
    this.setData({ overflow: !this.data.overflow })
  },
  //药品推荐
  drugsRecommend:function(){
    wx.navigateTo({
      url: '/hyb_yl/mysubpages/pages/drugs_recommend/drugs_recommend',
    })
  },
  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady: function () {
  
  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow: function () {
    var imgArr = wx.getStorageSync('imgArr')
    console.log(imgArr)
    this.setData({
      imgArr: imgArr
    })
  },
  //输入内容
  valInput:function(e){
    this.setData({
      value : e.detail.value
    })
  },
  //发送
  sendClick:function(){
    var imgArr = this.data.imgArr
    var value = this.data.value
    var conArr = this.data.conArr
    var obj = {}
    obj.img = '../images/header_01.png'
    obj.name = "张三丰"
    obj.time = "刚刚"
    obj.con = value
    obj.imgArr = imgArr
    conArr.push(obj)
    this.setData({
      conArr: conArr,
      value: ""
    })
  },
  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide: function () {
    wx.removeStorageSync('imgArr')
  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload: function () {
    wx.removeStorageSync('imgArr')
  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh: function () {
  
  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom: function () {
  
  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage: function () {
  
  }
})